<?php
	require '../../lib/init.php';
	$gCn=Con();	
	if($_GET['objid'] && $_GET['campid'] ) {
		$sql='insert into campaign_objects(object_id,campaign_id) values ('.$_GET['objid'].','.$_GET['campid'].') ;';
		$gCn->Execute($sql);		
	}
	
	$objid=(int)$_GET['objid'];
?>

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Add to Campaign</title>
</head>
<body align="center">
	<br><br>
	<table border="1" width="90%" align="center">
	<tr><th width="40px">ID</th><th>Име</th><th width="240px" >Actions</th></tr>
		<?php
			$sql='select * from campaigns order by campaign_id desc;';
			$gCn->Execute($sql);
			$gCn->MoveFirst();
			while(!$gCn->EOF()) {
				echo '<tr><td>'.$gCn->mRs['campaign_id'].'</td><td>'.$gCn->mRs['name'].'</td><td> <a href="addToCamp.php?campid='.$gCn->mRs['campaign_id'].'&objid='.$objid.'">Add to this campaign</a></td></tr>';
				$gCn->MoveNext();
			}
			$gCn->Close();
		?>
	</table>


	
	
	
</body>
</html>